package com.zfp.sys.controller;

import com.zfp.sys.entity.SysAccount;
import com.zfp.sys.entity.SysUser;
import com.zfp.sys.service.SysAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * Created by Administrator on 2017/7/25.
 */
@RequestMapping("sys/sysAccount/")
@Controller
public class SysAccountController {
    @Autowired
    SysAccountService sysAccountService;

    @RequestMapping("turnEditPassword")
    public String turnEditPassword(){
        return "sys/editPassword";
    }

    @RequestMapping("editPassword")
    @ResponseBody
    public String editPassword(SysAccount sysAccount, HttpSession httpSession){
        SysUser sysUser = (SysUser) httpSession.getAttribute("sessionUser");
        Long userId = sysUser.getUserId();
        sysAccount.setUserId(userId);
        return sysAccountService.editPassword(sysAccount);

    }
}
